﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.BlackApart.Business.Apartments;

namespace blackhouse.BlackApart.Business.Prices {
    public static class ApartmentPriceExtension {

        public static double GetPromoPriceFrom(this IApartmentPrice price, IApartmentGroup forGroup) {
            price.ReservationFromDay = DateTime.Now;
            price.ReservationToDay = price.ReservationFromDay.AddDays(1);
            price.ReservationNumberOfPeoples = 1;
            return price.GetPrice();
        }

        public static double GetPricePerNight(this IApartmentPrice price) {
            double p = price.GetPrice();
            double l = Math.Floor((price.ReservationToDay.Date - price.ReservationFromDay.Date).TotalDays);

            return Math.Round(p / l, 2);
        }

    }
}
